package com.mtons.mblog.web.controller.test;

import com.mtons.mblog.modules.entity.IBlogJSONResult;
import com.mtons.mblog.modules.utils.RedisOperator;
import io.lettuce.core.RedisClient;
import org.apache.shiro.dao.DataAccessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.StringRedisConnection;
import org.springframework.data.redis.core.BoundValueOperations;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yuyu
 */
@RestController
@RequestMapping("redis")
public class RedisController {
    @Autowired
    private StringRedisTemplate strRedis;

    @Autowired
    private RedisOperator redis;


    @RequestMapping("/testMiuu")
    public IBlogJSONResult testMiuu() {
        strRedis.opsForValue().set("imiuu-cache","hello miuu");
        return IBlogJSONResult.ok(strRedis.opsForValue().get("imiuu-cache"));
    }



}
